﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ICE.Vacations.Logica.Users;
using ICE.Vacations.Logica.Solicitudes;
using ICE.Vacations.Entidades;
using System.IO;
using Microsoft.Reporting.WebForms;
namespace ICE.Vacations.WebASP
{
    public partial class solicitudC : System.Web.UI.Page
    {
        

        protected void Page_Load(object sender, EventArgs e)
        {
            cargarDatos();
        }

        public void cargarDatos()
        {
            if (!String.IsNullOrEmpty(Request.QueryString["usna"]))
            {
                txtNombre.Text = Request.QueryString["usna"];
                txtCedula.Text = Request.QueryString["usce"];
                txtDiasDisponibles.Text = Request.QueryString["didi"];
                txtDiasSolicitados.Text = Request.QueryString["diso"];
                txtfechaInicio.Text = Request.QueryString["fein"];
                txtFechaFin.Text = Request.QueryString["fefi"];
                gridAp.DataSource = (List<string>)Session["aprobadores"];
                gridAp.DataBind();
            }
        }

        protected void verPDFbtn_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["file"]))
            {
                Response.ContentType = "application/pdf";
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + Request.QueryString["file"]);
                Response.TransmitFile(Server.MapPath("~/PDF/" + Request.QueryString["file"]));
                Response.End();
                
            }
            else
            {
                Response.Redirect("solicitudPropia.aspx", false);
            }


        }
        


    }
}